home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 12 / Cream of the Crop 12 (Part II) / Cream of the Crop 12 (Part II).iso / BBS / EZY120_1.ZIP / STRUCT.ARJ / CLIB.ARJ / DATE3.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-09  |  709 b   |  25 lines

  1. #include <ezycom.h>
  2. #include <ezylib.h>
  3.  
  4. /**********************************************************
  5.  * Convert an Word to a Date
  6.  *
  7.  * Returns the converted date in the variables yy,mm,dd
  8.  * and a true false value in relation to the conversion.
  9.  *
  10.  * eg: if (!word2date(worddate,year,mon,day)) is_error();
  11.  **********************************************************/
  12. int Word2Date(word Date, word &yy, word &mm, word &dd)
  13. {
  14.     word temp=Date;
  15.  
  16.     if (Date == 65535U) return(0);          /* Invalid Date */
  17.  
  18.     dd = (temp & 31) + 1;
  19.     temp >>= 5;
  20.     mm = (temp & 15) + 1;
  21.     temp >>= 4;
  22.     yy = (temp & 127) + 1980;
  23.     return(1);                         /* Conversion OK */
  24. }
  25.